/*
 * Copyright 2010 Mttang.com All right reserved. This software is the
 * confidential and proprietary information of Mttang.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Mttang.com.
 */
package com.mttang.sys.integration.dao.support;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.mttang.sys.dto.RolePrivilegeDTO;
import com.mttang.sys.integration.dao.RolePrivilegeDAO;

/**
 * 类RoleprivilegeDAOImpl.java的实现描述：TODO 类实现描述 
 * @author acc 2010-6-1 下午05:35:49
 */
public class RolePrivilegeDAOImpl  extends SqlMapClientDaoSupport implements RolePrivilegeDAO {

    private Log logger = LogFactory.getLog(getClass());
    /* (non-Javadoc)
     * @see com.mttang.sys.integration.dao.RoleprivilegeDAO#delete(com.mttang.sys.dto.RoleprivilegeDTO)
     */
    @Override
    public void delete(RolePrivilegeDTO dto) {
        // TODO Auto-generated method stub
        if (logger.isInfoEnabled()) {
            logger.info("---RolePrivilegeDAOImpl---delete");
        }
        getSqlMapClientTemplate().delete("SYS.deleteRolePrivilege", dto);
    }

    /* (non-Javadoc)
     * @see com.mttang.sys.integration.dao.RoleprivilegeDAO#findById(java.lang.Integer)
     */
    @SuppressWarnings("unchecked")
    @Override
    public List<RolePrivilegeDTO> findById(Integer roleId) {
        // TODO Auto-generated method stub
        if (logger.isInfoEnabled()) {
            logger.info("---RolePrivilegeDAOImpl---findById");
        }
        return getSqlMapClientTemplate().queryForList("SYS.selectRolePrivilege", roleId);
    }

    /* (non-Javadoc)
     * @see com.mttang.sys.integration.dao.RoleprivilegeDAO#insert(com.mttang.sys.dto.RoleprivilegeDTO)
     */
    @Override
    public void insert(RolePrivilegeDTO dto) {
        // TODO Auto-generated method stub
        if (logger.isInfoEnabled()) {
            logger.info("---RolePrivilegeDAOImpl---insert");
        }
        getSqlMapClientTemplate().insert("SYS.insertRolePrivilege", dto);
    }

    /* (non-Javadoc)
     * @see com.mttang.sys.integration.dao.RolePrivilegeDAO#insertRole(com.mttang.sys.dto.RolePrivilegeDTO)
     */
    @Override
    public void insertRole(RolePrivilegeDTO dto) {
        // TODO Auto-generated method stub
        if (logger.isInfoEnabled()) {
            logger.info("---RolePrivilegeDAOImpl---insertRole");
        }
        getSqlMapClientTemplate().insert("SYS.insertRolePrv", dto);
    }

}
